package pl.edu.agh.bd2.domain;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;

@Entity
@Table(name="Topic")
public class Topic {
	
	@Id
	@GeneratedValue
	@NotNull
	private long id;
	
	@Column(name="topic")
	@Length(max=300)
	private String topic;
	
	@Column(name="_date")
	@Temporal(TemporalType.DATE)
	private Date date;
	
	
	@ManyToOne
	@JoinColumn(name="subject")
	private Subject subject;
	
	protected Topic() {
	}

	public Topic(String topic, Date date, Subject subject) {
		super();
		this.topic = topic;
		this.date = date;
		this.subject = subject;
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getTopic() {
		return topic;
	}

	public void setTopic(String topic) {
		this.topic = topic;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public Subject getSubject() {
		return subject;
	}

	public void setSubject(Subject subject) {
		this.subject = subject;
	}
	
	
}